cmake_minimum_required(VERSION 3.12)
project(jtt808_muduo)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "-pthread")
add_executable(jtt808_server server.cpp
        codec/data_utils.cpp
        )
add_executable(jtt808_client client.cpp
        codec/data_utils.cpp
        )

set(MYLIB_ROOT ~/pkg)
set(BOOST_ROOT ~/pkg)
add_compile_definitions(MUDUO_STD_STRING=1)
find_path(LIBGLOG_INCLUDE_DIR glog/logging.h)

find_library(LIBGLOG_LIBRARY glog)
find_package(Boost 1.67.0 REQUIRED COMPONENTS system)
find_library(MUDUO_BASE_LIBRARY NAMES muduo_base PATHS "${MYLIB_ROOT}/lib")
find_library(MUDUO_NET_LIBRARY NAMES muduo_net PATHS "${MYLIB_ROOT}/lib")

include_directories(${LIBGLOG_INCLUDE_DIR} "${MYLIB_ROOT}/include")
target_link_libraries(jtt808_server ${Boost_LIBRARIES} ${MUDUO_NET_LIBRARY} ${MUDUO_BASE_LIBRARY} ${LIBGLOG_LIBRARY})
target_link_libraries(jtt808_client ${Boost_LIBRARIES} ${MUDUO_NET_LIBRARY} ${MUDUO_BASE_LIBRARY} ${LIBGLOG_LIBRARY})